﻿package config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101800712422";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDa9jSOwjFn6rAbMBOZyMFpdf3qFNS/YwNk+RDu0QS2tAPglVEUOlv4QzZ3tA61dh/xeBKF92vxo3cd3vLthFMEo7OBuItbuoE/+JsDePblITwOfNwDWRaCUeW2WPmxndNClpEfZJIBfnSqwHN2LFx5gVFyA9qTzJ8WB8ufsZxdihzIe6gbIOfyfny115SQOHFmAOYqn4arYKqQCaCM21EM4zYN0iUqDFWqZW9jQ1MtXtYwkA4S5Bq1l4kPjUGVMJYGm6ZJXShUdhg051G7eAFcGl84qWNxItYSlJ9B6YOlR7e8VFptkUNFgpeJmsrJZWVYlcvdiPNH433KMOxtFhGrAgMBAAECggEAbs1gU02ZyshMTbXKdWvN1BxNXYMlFaR5N0OCehdzlzEJNUDaQq41lDAPBAwt1U3tZDgqx3gpO6JIyOjlbaQkjph4YhCNFOIQPdsENoGkDtb+mSY9/8O5TEE9SUVFNchz+6JN1eECsZbYWwAAbbCNKz9xg4zHszs81d0kAa/TPNGTlVtqs5BB+Rjxra9K+usD242cq8APuhQt8YsZiBlg3T7LwsYR23Kj9nkbY6VYvinszOD63qAy6JEGjRWjpfdzmevzFWYIUEjd0tu9sXTA5IJwgrALOUtQcYREF0MKXtLpnVqHVF2p16AePP9MptvsgqX70Kt93cPF5I7qvDV1AQKBgQDvQtdFG7MFm8Vc3ilVEMyBRvXCtRzgSkj16sTFjuV4z+SPcbtw9A7gI6DpkTZjhIkP4Go+6EqnBO8O2X5Efg7FxdTQO9fS4sgKR/vcFkEnmc3hSL0mOivP/QWah1e680i+OC8ncumjxTlG/JIls/w1JHZDYmEscH0BgWKdi48DYQKBgQDqR82zEb9LZvkEnqTDgpYn9SnEQVKj9FBtHxnZ4vt82ngkusQiZg++I+RH2EgvlBCyGRSc3v0766oPFUQPbys/7IxRFjBJIx69F4xyfJehpV9Rpq26x9HNwiehXucdcBhKUaEx/+Vr5Vyw4MpyNnm+P4dCpeTwi9zmnymGGHS8iwKBgHFyrSY8qxc2tE+Dm++U5pNJ9VAclpOXRZ8tcZ4HUrGFSefmUq2NW9xVqH/3deWcO21GyLoJZRRq13ugDyok55ZJZs5SAdUh6R5O4ZKLDtvbJu7ykZWlsY6Od/C8yhGAN/bSJzG6YCRiaPVK33V3MVh1cIolBNSQhgWHtx3ixa4hAoGBAK8SRUcBhiAErSWkn59yYF8vt6xu3CClG8zPpvPJyQD+CTX5U0QZXL5L9/UwTJExZmCQmXS4tigm7Ygj7h5ShtFYJWsa165vzjKj/FI5hN5IxDgyBDVFySSnaBIQ50h6UcyHv5urjHfaiC+ta9t5lfRzaNKHQdP30HWOjuskL2gNAoGAQ0eHmjYDbI/p5sMfDKUJkzQGMcl7UPdUZ/j6Pvx1tmeGKprTMeO+hoLa7YHkK/qVgF4n7JS4riQkIp5NGyQMHVFUySyz/R5BP0rwhP43019vDsFvFc/9RhOsKcATUFN82mbmrud0CyUr+/94qb4WwnS9UsJm2dSOMqWk12kL7Ok=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiyUJgwF/dWFiKStzezY+Iu798t9m8fvVG51XITx3rjjWu5I2bJQpHpSmkyg4Y0OZ1WsQ/fsnm0QS2hob3hylfIhp40HgG9mJmAUUEk3HaSkS6ThERxXdw/9Ku+4MflICA6ZeXpD7Pk5r5P11pj39es8ywLldkNAsrqy26QjnPPWDrRcz7KCdB+orRqVhqDoWw7kJ4FYFxwqvT8vOe9YF/a4uD9+DwfeCxm3rHC7EKtKIbsoaopiaE3puAid0JLCZJ/ziFrUIyQiVPxzNFir2J7jtow88ReTK0HIZdYq9J4yq6ZAxdCP6jCOLaLPqjfZAeBh2AnQ3+DMjuwlZ4j9mNQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://hyl.mynatapp.cc/AliPayDemo/AliPaynotifyUrl";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://hyl.mynatapp.cc/AliPayDemo/AliPayReturnUrl";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

